package org.jeecg.activiti.MyUserInfo;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;

/**
 * @author UmizzZ
 * @date
 */
@Slf4j
public class UserInfoSetting implements JavaDelegate {

    @Override
    public void execute(DelegateExecution execution){
        log.info("用户基础信息设置");
        JSONObject jsonObject = JSON.parseObject(String.valueOf(execution.getVariable("bpm$user")));
        Integer credit = Integer.valueOf(String.valueOf(jsonObject.get("credit")));
        Double balance = Double.valueOf(String.valueOf(jsonObject.get("balance")));
        execution.setVariable("credit", credit);
        execution.setVariable("balance", balance);
    }
}
